netfront: Check availability of grant references in start_xmit().
authorkfraser@localhost.localdomain <kfraser@localhost.localdomain>
Thu, 25 Jan 2007 12:24:43 +0000 (12:24 +0000)
committerkfraser@localhost.localdomain <kfraser@localhost.localdomain>
Thu, 25 Jan 2007 12:24:43 +0000 (12:24 +0000)
Signed-off-by: Tomonari Horikoshi <t.horikoshi@jp.fujitsu.com>
linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c

index 448a972cc428336f26b666efb632d692a2f0b532..01ccb15b72cdaf0633d47ec0c90bb0b2bfe3f79f 100644 (file)
@@ -613,6 +613,10 @@ static int network_open(struct net_device *dev)
 
 static inline int netfront_tx_slot_available(struct netfront_info *np)
 {
+       /* XXX Need to check we have enough grants for worst-case fragments. */
+       if (gnttab_empty_grant_references(&np->gref_tx_head))
+               return 0;
+
        return RING_FREE_REQUESTS(&np->tx) >= MAX_SKB_FRAGS + 2;
 }